package org.example.day20240827;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Map<String,Integer> prizeMap = new HashMap<>();
        prizeMap.put("同花顺",250);
        prizeMap.put("四条",200);
        prizeMap.put("满堂红",150);
        prizeMap.put("同花",100);
        prizeMap.put("顺子",50);
        prizeMap.put("三条",20);
        prizeMap.put("两对",10);
        prizeMap.put("一对",-20);
        prizeMap.put("无对",-100);
        Poker poker = new Poker();
        List<Card> hand = new ArrayList<>();
        int score = 100;
        Scanner scanner = new Scanner(System.in);
        int times = 1;
        while (score > 0){
            score--;
            System.out.println("现在的分数是："+score);

            hand = poker.getOneHand();
            for(Card card : hand){
                System.out.print(card+" ");
            }
            System.out.println("请输入您想交换的牌号（1-5），用空格分割；如果什么都不想换，请输入回车");
            String line = scanner.nextLine();
            if(!line.isEmpty()){
                String[] arr = line.split(" ");
                for(int i = 0; i < arr.length;i++){
                    int index = Integer.valueOf(arr[i]);
                    index--;
                    hand.remove(index);
                    hand.add(index, poker.getOneCard(i+5));
                }
            }

            System.out.println("换牌之后");
            for(Card card : hand){
                System.out.print(card+" ");
            }
            String type = poker.getType(hand);
            System.out.println(type);
            int prize = prizeMap.get(type);
            score+=prize;
        }
    }

}
